/**
 * The contents of this file are subject to the license and copyright detailed in the LICENSE and NOTICE files at the root of the source tree and available online at
 * http://www.askosi.org/license.html
 */
package be.destin.skos.core;

public class MetadataValueToken {
	String value = null;
	Concept concept = null;
	boolean word = false;
	boolean blankAfter = false;
	
	MetadataValueToken (String aValue, boolean word, boolean blankAfter) {
		super();
		this.value = aValue;
		this.concept = null;
		this.word = word;
		this.blankAfter = blankAfter;
	}

	MetadataValueToken (Concept aConcept, boolean blankAfter) {
		super();
		if (aConcept.getInScheme().getAbout() == SkosManager.aboutPrefixes) {
			this.value = aConcept.getAbout()+'_';
		} else if (aConcept.getInScheme().getAbout() == SkosManager.aboutSuffixes) {
			this.value = '_'+aConcept.getAbout();
		} else this.value = aConcept.getScheme_About();
		this.concept = aConcept;
		this.word = true;
		this.blankAfter = blankAfter;
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * @param value the value to set
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * @return the concept
	 */
	public Concept getConcept() {
		return concept;
	}

	/**
	 * @return the concept
	 */
	public Concept getAllConcepts() {
		return concept;
	}

	/**
	 * @param concept the concept to set
	 */
	public void setConcept(Concept concept) {
		this.concept = concept;
		this.value = this.concept.getScheme_About();
		this.word = true;
	}

	/**
	 * @return the word
	 */
	public boolean isWord() {
		return word;
	}

	/**
	 * @param word the word to set
	 */
	public void setWord(boolean word) {
		this.word = word;
	}

	/**
	 * @return the blankAfter
	 */
	public boolean isBlankAfter() {
		return blankAfter;
	}

	/**
	 * @param blankAfter the blankAfter to set
	 */
	public void setBlankAfter(boolean blankAfter) {
		this.blankAfter = blankAfter;
	}
	
	public String toString() {
		return this.value+(blankAfter?" ":"");
	}
}
